﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Client
{
    public partial class QuestionForm : Form
    {
        StreamWriter streamWriter;
        public QuestionForm(StreamWriter sw)
        {
            streamWriter = sw;
            InitializeComponent();
        }

        public QuestionForm(StreamWriter sw, string question, string a, string b, string c, string d)
            : this(sw)
        {
            m_lblQuestion.Text = question;
            m_rdioChoice0.Text = a;
            m_rdioChoice1.Text = b;
            m_rdioChoice2.Text = c;
            m_rdioChoice3.Text = d;
        }

        private void m_btnSubmit_Click(object sender, EventArgs e)
        {
            if (m_rdioChoice0.Checked)
                streamWriter.WriteLine(0);
            else if (m_rdioChoice1.Checked)
                streamWriter.WriteLine(1);
            else if (m_rdioChoice2.Checked)
                streamWriter.WriteLine(2);
            else if (m_rdioChoice3.Checked)
                streamWriter.WriteLine(3);
            else
                streamWriter.WriteLine(-1);
            streamWriter.Flush();
            Close();
        }
    }
}
